<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>{$sysinfo['title']}</title>
    <link rel="stylesheet" href="/static/css/weui.css" />

    <link rel="stylesheet" href="/static/css/login.css" />
</head>
<style>
    body{
        color: #616161;
        font-size:15px;
    }
    .footer{
        margin-top:25px;
        text-align:center;
    }
    .kh_btn {
        width: 85%;
        color: #fff;
        background: #FF1E82;
        line-height: 35px;
        font-size: 14px;
        border: none;
        border-radius:5px;
    }
    .btn{
        margin-top:15px;
        width: 85%;
        color: #fff;
        background: #b3b3b3;
        line-height: 35px;
        font-size: 14px;
        border: none;
        border-radius:5px;
    }
</style>
<body>
<div class='indexbg' data-uid="{$user['uniacid']}">
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">提现金额</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="number" name="tx_pic" id="tx_pic" pattern="[0-9]*" placeholder="请输入整数金额"/>
            </div>
        </div>
    </div>
    <div class="footer">
        <input type="hidden" id="openid" value="{$user['openid']}">
        <input type="hidden" id="uid" value="{$user['id']}">

        <button class=" click_button kh_btn">申请提现</button>
        <button class=" click_button btn">取消</button>
    </div>
</div>


</body>
<script src="/static/js/jquery-3.2.1.js"></script>
<script src="/static/js/layer.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
    wx.config({$jssdkconfig});
    wx.ready(function () {
        wx.onMenuShareAppMessage({
            title: "{$jssdksharedata['title']}", // 分享标题
            desc: "{$jssdksharedata['desc']}", // 分享描述
            link: "{$jssdksharedata['link']}", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            success: function () {
                $.ajax({
                    url: "{:url('member/sharebalace')}",
                    data: {
                    },
                    dataType: "json",
                    type: "post",
                    success: function (res) {
                        console.log(11,res);
                        if(res.code==0){

                        }
                    }
                })
            }
        });
        wx.onMenuShareTimeline({
            title: '', // 分享标题
            link: '', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: '', // 分享图标
            success: function () {
                // 用户点击了分享后执行的回调函数
                $.ajax({
                    url: "{:url('member/sharebalace')}",
                    data: {
                    },
                    dataType: "json",
                    type: "post",
                    success: function (res) {
                        console.log(11,res);
                        if(res.code==0){

                        }
                    }
                })
            },
        })

    })
</script>
<script type="text/javascript">
  $(".kh_btn").click(function(){
      var openid=$('#openid').val();
      var uid=$('#uid').val();
      var pic=Number($('#tx_pic').val());
      console.log(pic<1||pic>200);
      if(pic==""||pic<1||pic>200){
          layer.msg("请输入正确的提现金额，最少1元，最多200元");
          return false
      }
        if(pic!==""||pic>1||pic<200){
            $(".kh_btn").attr("disabled","true");
            $(".kh_btn").attr("style","background:#eee;");
        }
          $.ajax({
              url: "{:url('')}",
              data: {
                  openid:openid,
                  user_id:uid,
                  price:pic
              },
              dataType: "json",
              type: "post",
              success: function (res) {
                  console.log(66, res);
                  if (res.code == 0) {
                      layer.msg(res.message);
                          setTimeout(function(){
                                window.location.href="{:url('marke/index',array('platid'=>$user['uniacid']))}";
                            },500)
                  }else{
                      layer.msg(res.message);
                  }
              }
          });

  })
    $(".btn").click(function(){
        setTimeout(function(){
            window.location.href="{:url('marke/index',array('platid'=>$user['uniacid']))}";
        },500)
    });
</script>
</html>
